# import com.it.package.Student as s
#
# s.fun01()
#
# from com.it.School import fun01
#
# fun01()
#
# from com.it.package import *
#
# Student.fun01()
# Student.Student(23).fun02()
#

def calculate():
    try:
        10 / int(input("请输入整数："))
    except:
        print("出错了")


def calculate2():
    try:
        print(10 / int(input("请输入整数：")))
    except ValueError:
        print("输入的不是整数")
    except ZeroDivisionError:
        print("不能除零")
    else:
        print("其他错误")


# calculate()
# calculate2()

list01 = [4, 5, 55, 35]

iterator = list01.__iter__()

while True:
    try:
        item = iterator.__next__()
        print(item)
    except StopIteration as s:
        print(s.__str__())
        break


# fun01 = lambda num: num * num
# fun02 = lambda: print("hello")
# fun03 = lambda a, b, c: a + b + c
#
# print(fun01(10))
# fun02()
# print(fun03(1, 2, 3))


#
# # 闭包
# def fun01(money):
#     def fun02(num):
#         nonlocal money
#         if money > num:
#             money -= num
#             print("余额：", money)
#         else:
#             print("余额不足")
#
#     return fun02
#
#
# fun03 = fun01(1000)
# fun03(200)
# fun03(400)
# fun03(500)


def add_name_to_say(func):
    def wrapper(*args, **kwargs):
        print(func.__name__)

        return func(*args, **kwargs)

    return wrapper


@add_name_to_say
def say_hello():
    print("hello")


@add_name_to_say
def say_goodbye():
    print("goodbye")


say_hello()
say_goodbye()
